<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddColumnsToBizMigration extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $table = $this->table('biz');
        $table->addColumn('star', 'integer', [
            'null' => false,
            'default' => 0,
            'limit' => 2,
            'comment' => '星级：1-5',
        ])
        ->addColumn('status', 'integer', [
            'null' => false,
            'default' => 1,
            'limit' => 1,
            'comment' => '状态：1正常 0禁用',
        ])
        ->addColumn('deleted_at', 'integer', [
            'null' => true,
            'limit' => 11,
            'comment' => '删除时间',
        ])
        ->addColumn('comment_total', 'integer', [
            'null' => false,
            'limit' => 11,
            'default' => 0,
            'comment' => '评论总数',
        ])
        ->addColumn('shop_address', 'string', [
            'null' => false,
            'limit' => 255,
            'default' => '',
                'comment' => '店铺地址',
        ])
        ->addColumn('biz_phone', 'string', [
            'null' => false,
            'limit' => 32,
            'default' => '',
            'comment' => '店铺电话',
        ])
        ->update();
    }
}
